<template>
	<section>
		<el-table v-loading="loading" :data="financeList" stripe style="width: 1101px;text-align: center;">
		    <el-table-column header-align="center" prop="taskId" label="流水ID" width="250">
		    </el-table-column>
		    <el-table-column header-align="center" prop="channel" label="支付渠道" width="250">
		    </el-table-column>
		    <el-table-column header-align="center" prop="type" label="支付类型(支付、收入)" width="200">
    		</el-table-column>
    		<el-table-column header-align="center" prop="price" label="金额" width="200">
		    </el-table-column>
		    <el-table-column header-align="center" prop="createTime" label="时间" width="200">
		    </el-table-column>
  		</el-table>
  		<!-- 分页 -->
  		<!-- <el-col :span="24" class="toolbar">
	      <el-pagination layout="prev, pager, next" @current-change="pageChange" :page-size="num" :total="total" style="float:right;">
	      </el-pagination>
	      <div class="all">总计<span class="total">{{total}}</span>条记录</div>
	    </el-col> -->
	</section>
</template>
<script>
	import { sendData, cutString } from "../../api/api";
	export default{
		data(){
			return{
				total:0,
				page:1,
				num:20,
				loading:false,
				financeList:[]
			}
		},
		methods:{
			getfinance(){
				let id=Number(sessionStorage.getItem("memberID"))
				this.loading=true
				let page=Number(this.page)
				let params=sendData({url: "user/finance",msg: {id:id,pgNo:page,num:this.num}})
				this.$http.get(params.baseURL,{params:params.params}).then(res=>{
					var res=cutString(res.bodyText)
					console.log(res.msg)
				res.msg.map(function(v,i){
					v.createTime=v.createTime.slice(0,19)
					v.price=(v.price/100).toFixed(2)
					v.type=v.type==0?"支出":"收入"
				})
				this.total=res.msg.length
				this.financeList=res.msg
				this.loading=false
				})
			},
			// 分页
			pageChange(){}
		},
		mounted() {
			  this.getfinance();
			}
	}
</script>